﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Globalization;
using ZH.Infrastructure.Dto.Request.Order;
using ZH.Service.Interface;

namespace ZH.Api.Admin.Controllers.Admin
{

    /// <summary>
    /// 管理端·订单
    /// </summary>
    public class OrderController : BaseController
    {
        private readonly I_Order_Service _order_Service;

        public OrderController(I_Login_Service login_Service,I_Order_Service order_Service) : base(login_Service)
        {

            _order_Service = order_Service;
        }

        /// <summary>
        /// 获取订单列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Order(int? page = 1, int? limit = 10, string? key = "") {

            var result = await _order_Service.Get_Order( new Order_Request_Dto { 
            
                page = page,
                limit = limit,  
                key = key
            
            }
                );
            return Ok(result);
        }

        /// <summary>
        /// 获取今日订单
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_toOrder(int? page = 1, int? limit = 10, string? key = "") {

            var result = await _order_Service.Get_toOrder(new Order_Request_Dto
            {
                page = page,
                limit = limit,
                key = key
            }
              );
            return Ok(result);

        }


        /// <summary>
        /// 获取订单详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Order_Xq(string id)
        {
            var result = await _order_Service.Get_Order_Xq(id);
            return Ok(result);
        }

    }
}
